﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Space_Cleaner.SpaceCleaner
{
    class SC_Effect : SC_SpaceObject
    {
        protected int duration;

        public SC_Effect(Texture2D _texture) : base(Vector2.Zero, 0, 0, _texture)
        {
            size = 0.05f;
            rotationVel = 2.0f;
            duration = 0;
        }

        ~SC_Effect()
        {

        }

        public int Duration
        {
            get { return duration; }
            set { duration = value; }
        }

        public void start()
        {
            activated = true;
        }

        public override void update(TimeSpan elapsedTime)
        {
            if (Duration < 0)
            {
                activated = false;
                return;
            }

            if (activated)
            {
                rotation += rotationVel * elapsedTime.Milliseconds;
                position += velocity * elapsedTime.Milliseconds;

                if (Duration >= 5)
                {
                    size *= 1.45f;
                }
                else if (Duration <= 5)
                {
                    size *= 0.4f;
                }
            }
            Duration--;
        }
    }
}
